<?php
class Admin_SystemController extends Zend_Controller_Action
{       
      /**
     * Met à jour la liste des actions de tous les modules
     * @return unknown_type
     */
    public function updateModulesActionsAction()
    {
    	$systemModules = App_File::getDirectories(APPLICATION_PATH.'/modules');
    	$allActions = new App_Model_SystemActions();
    	//print_r($systemModules);exit;
    	foreach($systemModules as $module) {
    		//echo $module . '<br />';    		
    		$controllersDir = APPLICATION_PATH	. '/modules/' . $module . '/controllers';    		
    		if(is_dir($controllersDir)) {
    			$systemControllers = App_File::getFiles($controllersDir);
    			///print_r($systemControllers);
    			//echo "<hr />";
    			$moduleControllersActons = new Admin_Model_ActionsDetector($controllersDir,$systemControllers);    			
    			$moduleControllersActons = $moduleControllersActons->getActions();
    			//print_r($moduleControllersActons);exit;
    			
	    		foreach($moduleControllersActons as $controller => $actions) {
	    			foreach($actions as $key => $action)
	    			if(!$allActions->getRow($module,$controller,$action)) {
	    				$allActions->insert(array('module'  => $module,
	    										  'controller' => $controller,
	    				                           'action' => $action));
	    			}
	    		}
    		}
    	}		
       	//$this->_forward('modules');
       	die('good');
    }   
}